<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="ru" />
<title>Баланс</title>
<STYLE type="text/css">
body {
	font: 8pt Tahoma,Arial,Helvetica,sans-serif; 
	color: #222222
}
table {
	border-collapse:collapse;
	margin: 0;
}
table.job_pm_body td {
	vertical-align:baseline;
	white-space: nowrap;
	text-align: center;
	padding: 0 2pt;
}
table.job_pm_prefix td {
	border: solid 1px black;	
	vertical-align:baseline;
	white-space: nowrap;
	padding: 0 2pt;
}
table.job_pm_title td {
	white-space: nowrap;
	padding: 0 4pt;
}
sup {
	font-size: 6pt;
}
</STYLE>

</head>

<body>
	<center><h3>Детализированный баланс по выбранным работам</h3></center>
	{foreach $data->job as $job}
		<table class="job_pm_title">
		<tr><td align="right">Объект:</td><td><b>{$job->build_name}</b></td><td align="right">Начало:</td><td>{$job->job_start}</td></tr>
		<tr><td align="right">Стоимость:</td><td>{$job->job_cost}</td><td align="right">Окончание:</td><td>{$job->job_finish}</td></tr>
		<tr><td align="right">Тип:</td><td colspan="3">{$job->jtp_descr}</td></tr>
		</table>
		<div style="display:inline-block; margin:0;"><table class="job_pm_prefix">
			<tr><td align="right">Приход:</td><td><b>{$job->itot}</b></td></tr>
			<tr><td align="right">Баланс:</td><td {if $job->btot lt 0}style="background-color:#dddddd"{/if}><b>{$job->btot}</b></td></tr>
			<tr><td align="right">Расход:</td><td><b>{$job->otot}</b></td></tr>
		</table></div>
		{foreach $job->bal as $bal}
			<div style="display:inline-block; margin:0;"><table class="job_pm_body">
			<tr><td style="border: solid 1px black;"><table width="100%"><tr>
			{foreach $job->inc as $inc}
				{if $inc->btp_id eq $bal->btp_id}
					<td>{$inc->itp_code}:{$inc->sum}</td>
				{/if}
			{/foreach}
			</tr></table></td></tr>
			<tr><td style="border: solid 1px black;">{$bal->btp_code}:{$bal->sum}</td></tr>
			<tr><td style="border: solid 1px black;"><table width="100%"><tr>
			{foreach $job->out as $out}
				{if $out->btp_id eq $bal->btp_id}
					<td>{$out->otp_code}:{$out->sum}</td>
				{/if}
			{/foreach}
			</tr></table></td></tr>
			</table></div>
		{/foreach}
		<br><br>
	{/foreach}
</body>
</html>
